//
//  ConfigTest.m
//  shoubao_user
//
//  Created by xiao_shoubao on 16/9/3.
//  Copyright © 2016年 xiao_shoubao. All rights reserved.
//

#import "ConfigTest.h"

#define TEST_Version @"TEST_Version" ///版本号
#define TEST_HTTP @"TEST_HTTP"  ///链接地址
#define TEST_IMAGEHTTP @"TEST_IMAGEHTTP"  ///图片链接地址


@implementation ConfigTest


+ (void)updateVersion:(NSString *)version{
#ifdef DEBUG
    [[NSUserDefaults standardUserDefaults] setValue:version forKey:TEST_Version];
#else
    /// 防止出现 漏洞
#endif
}

+ (NSString *)fetchVersion{
    
#ifdef DEBUG
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    if (![userDefaults objectForKey:TEST_Version]) {
        
        return kVersionPublic;
        
    }
    return [[NSUserDefaults standardUserDefaults] valueForKey:TEST_Version];
#else
    /// 防止出现 漏洞
    return kVersionPublic;
    
#endif
    
}

#pragma mark ----------------链接请求地址------------------------

+ (void)updateHTTP:(NSString *)http{
#ifdef DEBUG
    [[NSUserDefaults standardUserDefaults] setValue:http forKey:TEST_HTTP];
#else
    /// 防止出现 漏洞
#endif
}

+ (NSString *)fetchHTTP{
#ifdef DEBUG
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    if (![userDefaults objectForKey:TEST_HTTP]) {
        
        return @"http://ios.szshoubao.com";

    }
    NSLog(@"%@",[[NSUserDefaults standardUserDefaults] valueForKey:TEST_HTTP]);
    
    return [[NSUserDefaults standardUserDefaults] valueForKey:TEST_HTTP];
#else
    /// 防止出现 漏洞
    return  HTTPAPI;
#endif
}


#pragma mark ----------------图片请求地址------------------------

+ (void)updateImageHTTP:(NSString *)imagehttp{
#ifdef DEBUG
    [[NSUserDefaults standardUserDefaults] setValue:imagehttp forKey:TEST_IMAGEHTTP];
#else
    /// 防止出现 漏洞
#endif
}


+ (NSString *)fetchImageHTTP{
#ifdef DEBUG
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    if (![userDefaults objectForKey:TEST_IMAGEHTTP]) {
        return @"http://121.201.119.209";
    }
    return [[NSUserDefaults standardUserDefaults] valueForKey:TEST_IMAGEHTTP];
#else
    /// 防止出现 漏洞
    return HTTPIMAGE;
#endif
}


@end
